<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

function is_user_login() {
    $CI =& get_instance();
    return $CI->user->id ? true : false;
}

function api_user_do_login() {
    if (!is_user_login()) {
        api_failed('user_not_login');
    }
}

function user_do_login() {
    if (!is_user_login()) {
        die('user_not_login');
    }
}